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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: D = None
        self.t: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.z: E = None
        self.t: D = None
        self.v: C = None
        self.txt = txt

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

g.z = m
a.o = g
b.v = i
b.o = i
b.w = g
b.r = g
i.r = g
i.q = a
i.w = a
i.p = b
i.s = m
m.r = a
m.t = a
m.z = i
c.o = i
c.t = i
c.z = m
c.v = b
assert c.v.r.z.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: D = None
        self.t: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.z: E = None
        self.t: D = None
        self.v: C = None
        self.txt = txt

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

g.z = m
a.o = g
b.v = i
b.o = i
b.w = g
b.r = g
i.r = g
i.q = a
i.w = a
i.p = b
i.s = m
m.r = a
m.t = a
m.z = i
c.o = i
c.t = i
c.z = m
c.v = b
assert c.v.r.z.z.p.txt == "b"