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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: A = None
        self.t: A = None
        self.p: D = None
        self.s: A = None
        self.u: A = None
        self.txt = txt

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

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

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

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

d = A("d")
g = B("g")
l = C("l")
a = D("a")
k = E("k")
n = F("n")

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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: A = None
        self.t: A = None
        self.p: D = None
        self.s: A = None
        self.u: A = None
        self.txt = txt

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

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

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

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

d = A("d")
g = B("g")
l = C("l")
a = D("a")
k = E("k")
n = F("n")

d.r = g
d.s = n
g.q = l
g.z = d
g.t = d
g.s = d
g.u = d
g.p = a
l.t = g
l.v = n
a.y = g
a.p = g
a.t = k
a.s = k
a.u = n
a.x = d
k.w = g
k.u = l
k.q = l
k.t = a
k.o = n
n.p = l
n.q = d
assert a.p.z.r.u.r.txt == "g"