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

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

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

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

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

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

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

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

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

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

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

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

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

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

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