class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.r: F = None
        self.s: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.r: D = None
        self.v: D = None
        self.y: D = None
        self.s: F = None
        self.t: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: C = None
        self.z: C = None
        self.r: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.u: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

c = A("c")
d = B("d")
j = C("j")
m = D("m")
b = E("b")
g = F("g")
i = D("i")
n = A("n")
f = B("f")

c.p = n
c.s = n
c.r = g
d.u = c
d.r = m
d.v = i
d.y = i
d.s = g
d.t = b
j.u = f
m.y = d
m.s = j
m.z = j
m.r = b
b.q = f
b.u = i
g.q = b
i.y = d
i.s = j
i.z = j
i.r = b
n.p = c
n.s = c
n.r = g
f.u = n
f.r = i
f.v = i
f.y = i
f.s = g
f.t = b
assert f.u.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.r: F = None
        self.s: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.r: D = None
        self.v: D = None
        self.y: D = None
        self.s: F = None
        self.t: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: C = None
        self.z: C = None
        self.r: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.u: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

c = A("c")
d = B("d")
j = C("j")
m = D("m")
b = E("b")
g = F("g")
i = D("i")
n = A("n")
f = B("f")

c.p = n
c.s = n
c.r = g
d.u = c
d.r = m
d.v = i
d.y = i
d.s = g
d.t = b
j.u = f
m.y = d
m.s = j
m.z = j
m.r = b
b.q = f
b.u = i
g.q = b
i.y = d
i.s = j
i.z = j
i.r = b
n.p = c
n.s = c
n.r = g
f.u = n
f.r = i
f.v = i
f.y = i
f.s = g
f.t = b
assert f.u.r.q.txt == "b"