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

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

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

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

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

g.p = b
g.x = i
i.o = f
b.t = i
f.r = i
f.s = i
f.v = b
f.t = b
d.p = b
d.x = i
n.p = b
n.x = i
assert n.x.o.v.t.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: B = None
        self.txt = txt

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

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

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

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

g.p = b
g.x = i
i.o = f
b.t = i
f.r = i
f.s = i
f.v = b
f.t = b
d.p = b
d.x = i
n.p = b
n.x = i
assert n.x.o.v.t.o.v.txt == "b"