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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: F = None
        self.v: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: C = None
        self.u: F = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: F = None
        self.v: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: C = None
        self.u: F = None
        self.s: D = None
        self.txt = txt

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

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

i.p = m
m.y = d
m.o = e
m.s = e
g.t = b
g.w = b
g.q = d
g.u = a
g.o = m
d.p = b
d.x = e
d.v = e
a.p = b
a.r = g
a.u = e
a.s = d
e.x = g
e.v = i
b.t = g
b.w = g
b.q = d
b.u = a
b.o = m
assert d.p.t.q.x.v.p.txt == "m"