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

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

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

class D:
    def __init__(self, txt: str):
        self.t: D = None
        self.p: D = None
        self.r: A = None
        self.o: D = None
        self.txt = txt

j = A("j")
h = B("h")
l = C("l")
c = D("c")
e = A("e")
f = B("f")
b = B("b")
a = C("a")
n = D("n")

j.u = a
j.q = b
h.t = j
h.x = f
l.x = a
l.r = a
l.y = h
c.t = n
c.p = n
c.o = n
c.r = e
e.u = l
e.q = h
f.t = e
f.x = b
b.t = j
b.x = f
a.x = l
a.r = l
a.y = b
n.t = c
n.p = c
n.o = c
n.r = e
assert a.y.t.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: D = None
        self.p: D = None
        self.r: A = None
        self.o: D = None
        self.txt = txt

j = A("j")
h = B("h")
l = C("l")
c = D("c")
e = A("e")
f = B("f")
b = B("b")
a = C("a")
n = D("n")

j.u = a
j.q = b
h.t = j
h.x = f
l.x = a
l.r = a
l.y = h
c.t = n
c.p = n
c.o = n
c.r = e
e.u = l
e.q = h
f.t = e
f.x = b
b.t = j
b.x = f
a.x = l
a.r = l
a.y = b
n.t = c
n.p = c
n.o = c
n.r = e
assert a.y.t.q.x.txt == "f"