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

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: A = None
        self.w: D = None
        self.y: F = None
        self.r: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: E = None
        self.s: E = None
        self.y: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: A = None
        self.txt = txt

m = A("m")
c = B("c")
j = C("j")
f = D("f")
e = E("e")
b = F("b")
g = E("g")

m.r = c
c.w = m
c.y = m
c.t = m
c.u = g
c.r = j
c.o = f
j.q = c
j.r = c
j.s = m
j.w = f
j.y = b
f.q = c
f.r = j
e.o = f
e.p = g
e.s = g
e.y = b
b.x = f
b.w = m
g.o = f
g.p = e
g.s = e
g.y = b
assert e.o.q.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: A = None
        self.w: D = None
        self.y: F = None
        self.r: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: E = None
        self.s: E = None
        self.y: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: A = None
        self.txt = txt

m = A("m")
c = B("c")
j = C("j")
f = D("f")
e = E("e")
b = F("b")
g = E("g")

m.r = c
c.w = m
c.y = m
c.t = m
c.u = g
c.r = j
c.o = f
j.q = c
j.r = c
j.s = m
j.w = f
j.y = b
f.q = c
f.r = j
e.o = f
e.p = g
e.s = g
e.y = b
b.x = f
b.w = m
g.o = f
g.p = e
g.s = e
g.y = b
assert e.o.q.u.p.txt == "e"