class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.s: B = None
        self.u: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: D = None
        self.t: D = None
        self.txt = txt

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

d = A("d")
h = B("h")
b = C("b")
g = D("g")
f = C("f")

d.y = b
d.s = h
d.u = h
h.w = b
h.v = f
h.z = d
b.y = g
b.z = g
b.t = g
g.z = b
f.y = g
f.z = g
f.t = g
assert b.z.z.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.s: B = None
        self.u: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: D = None
        self.t: D = None
        self.txt = txt

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

d = A("d")
h = B("h")
b = C("b")
g = D("g")
f = C("f")

d.y = b
d.s = h
d.u = h
h.w = b
h.v = f
h.z = d
b.y = g
b.z = g
b.t = g
g.z = b
f.y = g
f.z = g
f.t = g
assert b.z.z.t.z.txt == "b"