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

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

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

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

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

f.r = b
f.z = g
h.s = i
h.o = g
h.v = k
g.u = b
g.x = f
i.o = n
k.o = h
n.s = k
n.v = k
n.o = g
d.o = h
b.r = f
b.z = g
j.r = b
j.z = g
assert b.z.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: C = None
        self.txt = txt

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

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

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

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

f.r = b
f.z = g
h.s = i
h.o = g
h.v = k
g.u = b
g.x = f
i.o = n
k.o = h
n.s = k
n.v = k
n.o = g
d.o = h
b.r = f
b.z = g
j.r = b
j.z = g
assert b.z.x.z.txt == "g"