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

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

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

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

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

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

j = A("j")
c = B("c")
l = C("l")
b = D("b")
k = E("k")
a = F("a")
d = C("d")
e = A("e")

j.q = c
j.r = c
j.s = e
j.y = b
c.s = j
c.t = j
l.o = d
l.u = d
l.x = d
l.r = a
b.w = c
b.x = j
k.x = b
a.t = c
d.o = l
d.u = l
d.x = l
d.r = a
e.q = c
e.r = c
e.s = j
e.y = b
assert k.x.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: A = None
        self.r: B = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

j = A("j")
c = B("c")
l = C("l")
b = D("b")
k = E("k")
a = F("a")
d = C("d")
e = A("e")

j.q = c
j.r = c
j.s = e
j.y = b
c.s = j
c.t = j
l.o = d
l.u = d
l.x = d
l.r = a
b.w = c
b.x = j
k.x = b
a.t = c
d.o = l
d.u = l
d.x = l
d.r = a
e.q = c
e.r = c
e.s = j
e.y = b
assert k.x.x.q.txt == "c"