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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: F = None
        self.w: C = None
        self.v: C = None
        self.y: E = None
        self.u: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: E = None
        self.r: D = None
        self.y: A = None
        self.q: F = None
        self.z: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.v: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: D = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: F = None
        self.w: C = None
        self.v: C = None
        self.y: E = None
        self.u: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: E = None
        self.r: D = None
        self.y: A = None
        self.q: F = None
        self.z: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.v: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: D = None
        self.txt = txt

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

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

d.u = j
d.s = g
n.q = f
n.y = f
n.t = a
n.w = g
n.v = g
n.u = g
g.p = n
g.u = f
g.z = f
g.r = c
g.y = d
g.q = a
c.y = n
c.v = n
f.o = d
f.r = c
a.q = n
j.q = n
assert g.p.t.q.w.q.q.u.txt == "g"