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

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

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

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

k = A("k")
j = B("j")
a = C("a")
g = D("g")
h = C("h")
c = A("c")
b = A("b")

k.p = h
k.v = h
j.z = c
j.s = g
j.p = g
j.t = g
a.t = h
g.v = h
h.t = a
c.p = h
c.v = a
b.p = h
b.v = a
assert k.v.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: C = None
        self.txt = txt

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

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

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

k = A("k")
j = B("j")
a = C("a")
g = D("g")
h = C("h")
c = A("c")
b = A("b")

k.p = h
k.v = h
j.z = c
j.s = g
j.p = g
j.t = g
a.t = h
g.v = h
h.t = a
c.p = h
c.v = a
b.p = h
b.v = a
assert k.v.t.t.t.txt == "a"