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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.o: A = None
        self.w: A = None
        self.p: A = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.o: A = None
        self.w: A = None
        self.p: A = None
        self.txt = txt

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

d.x = j
d.r = j
d.w = c
d.t = c
d.q = m
c.p = d
e.o = g
e.y = d
j.p = d
g.v = m
g.p = m
g.y = e
g.s = e
m.t = g
m.o = d
m.w = d
m.p = d
assert m.t.y.o.s.y.txt == "d"