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

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

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

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

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

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

b = A("b")
l = B("l")
h = C("h")
c = D("c")
f = E("f")
g = F("g")

b.z = c
b.v = c
b.y = g
b.t = g
b.r = l
l.p = c
l.z = b
h.z = b
c.s = l
c.t = l
f.t = c
f.r = b
g.z = l
g.w = f
g.o = c
g.v = h
assert l.z.t.o.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: F = None
        self.r: B = None
        self.v: D = None
        self.t: F = None
        self.txt = txt

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

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

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

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

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

b = A("b")
l = B("l")
h = C("h")
c = D("c")
f = E("f")
g = F("g")

b.z = c
b.v = c
b.y = g
b.t = g
b.r = l
l.p = c
l.z = b
h.z = b
c.s = l
c.t = l
f.t = c
f.r = b
g.z = l
g.w = f
g.o = c
g.v = h
assert l.z.t.o.t.z.txt == "b"