class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: C = None
        self.x: B = None
        self.t: D = None
        self.q: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.o: A = None
        self.z: A = None
        self.u: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: F = None
        self.u: F = None
        self.z: A = None
        self.txt = txt

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

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

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

l = A("l")
c = B("c")
n = C("n")
f = D("f")
a = E("a")
g = F("g")
e = C("e")

l.w = c
l.x = c
l.y = e
l.t = f
l.q = a
c.r = a
c.o = l
c.z = l
c.u = e
n.p = f
n.s = g
n.u = g
n.z = l
f.o = a
a.o = f
a.p = c
g.t = a
e.p = f
e.s = g
e.u = g
e.z = l
assert l.t.o.p.z.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: C = None
        self.x: B = None
        self.t: D = None
        self.q: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.o: A = None
        self.z: A = None
        self.u: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: F = None
        self.u: F = None
        self.z: A = None
        self.txt = txt

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

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

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

l = A("l")
c = B("c")
n = C("n")
f = D("f")
a = E("a")
g = F("g")
e = C("e")

l.w = c
l.x = c
l.y = e
l.t = f
l.q = a
c.r = a
c.o = l
c.z = l
c.u = e
n.p = f
n.s = g
n.u = g
n.z = l
f.o = a
a.o = f
a.p = c
g.t = a
e.p = f
e.s = g
e.u = g
e.z = l
assert l.t.o.p.z.y.p.txt == "f"