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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: D = None
        self.u: D = None
        self.t: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

g = A("g")
n = B("n")
l = C("l")
e = D("e")
d = E("d")
c = F("c")
a = D("a")
i = E("i")

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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: D = None
        self.u: D = None
        self.t: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

g = A("g")
n = B("n")
l = C("l")
e = D("e")
d = E("d")
c = F("c")
a = D("a")
i = E("i")

g.y = d
g.q = n
g.u = i
n.r = l
n.x = a
n.u = e
n.t = i
l.u = c
l.o = d
l.t = n
e.t = a
d.r = g
c.z = i
c.w = l
c.u = l
c.y = g
c.q = g
c.p = d
a.t = e
i.r = g
assert l.t.x.t.txt == "e"