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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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

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