class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: F = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: B = None
        self.z: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: F = None
        self.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: E = None
        self.t: B = None
        self.v: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: F = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: B = None
        self.z: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: F = None
        self.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: E = None
        self.t: B = None
        self.v: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: B = None
        self.txt = txt

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

d.r = i
d.u = i
j.q = f
j.r = n
j.z = b
b.v = i
b.w = f
b.z = f
c.r = j
c.p = j
c.z = n
g.x = a
g.v = a
g.t = f
n.u = d
n.v = j
a.x = g
a.v = g
a.t = j
i.r = d
i.u = d
f.q = j
f.r = n
f.z = b
assert j.q.q.q.z.z.q.txt == "j"