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

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

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.o: E = None
        self.t: D = None
        self.w: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: A = None
        self.u: D = None
        self.q: E = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.o: E = None
        self.t: D = None
        self.w: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: A = None
        self.u: D = None
        self.q: E = None
        self.txt = txt

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

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