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

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: F = None
        self.q: A = None
        self.v: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

a.y = d
a.u = d
a.o = l
a.x = l
k.u = d
k.t = l
d.r = h
b.t = d
b.p = j
b.q = a
b.v = a
h.q = a
h.t = a
h.x = a
j.o = h
m.u = d
m.t = l
l.u = d
l.t = k
assert d.r.q.x.t.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: C = None
        self.o: B = None
        self.x: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: F = None
        self.q: A = None
        self.v: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

a.y = d
a.u = d
a.o = l
a.x = l
k.u = d
k.t = l
d.r = h
b.t = d
b.p = j
b.q = a
b.v = a
h.q = a
h.t = a
h.x = a
j.o = h
m.u = d
m.t = l
l.u = d
l.t = k
assert d.r.q.x.t.t.t.t.t.txt == "k"