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

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.x: A = None
        self.v: F = None
        self.o: A = None
        self.p: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.x: A = None
        self.v: F = None
        self.o: A = None
        self.p: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: D = None
        self.txt = txt

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

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