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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: C = None
        self.y: B = None
        self.txt = txt

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

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

m.x = e
g.x = e
g.t = d
c.r = d
c.x = d
c.t = m
c.z = g
c.s = k
k.q = d
k.o = g
k.t = e
e.t = g
e.y = g
e.v = c
d.r = g
assert c.s.t.v.z.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: C = None
        self.y: B = None
        self.txt = txt

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

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

m.x = e
g.x = e
g.t = d
c.r = d
c.x = d
c.t = m
c.z = g
c.s = k
k.q = d
k.o = g
k.t = e
e.t = g
e.y = g
e.v = c
d.r = g
assert c.s.t.v.z.t.r.txt == "g"