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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: E = None
        self.x: D = None
        self.txt = txt

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

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

j = A("j")
k = B("k")
d = C("d")
a = D("a")
f = E("f")
h = A("h")
g = E("g")

j.q = d
j.s = k
j.v = a
k.t = j
k.u = a
k.z = d
d.y = k
d.s = f
d.x = a
a.o = d
f.t = a
h.q = d
h.s = k
h.v = a
g.t = a
assert d.y.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: B = None
        self.v: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: E = None
        self.x: D = None
        self.txt = txt

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

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

j = A("j")
k = B("k")
d = C("d")
a = D("a")
f = E("f")
h = A("h")
g = E("g")

j.q = d
j.s = k
j.v = a
k.t = j
k.u = a
k.z = d
d.y = k
d.s = f
d.x = a
a.o = d
f.t = a
h.q = d
h.s = k
h.v = a
g.t = a
assert d.y.t.q.txt == "d"