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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: D = None
        self.p: C = None
        self.q: E = None
        self.txt = txt

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

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

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

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

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

l.v = c
e.w = f
e.v = f
e.p = b
e.q = h
d.t = n
d.x = c
d.y = c
d.s = l
d.o = h
f.r = m
h.z = m
h.s = c
c.s = h
n.v = c
b.t = l
b.s = l
b.x = c
b.y = c
b.o = h
k.w = f
k.v = f
k.p = d
k.q = h
m.t = l
m.x = c
m.y = c
m.s = n
m.o = h
assert d.y.s.z.y.s.s.s.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: D = None
        self.p: C = None
        self.q: E = None
        self.txt = txt

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

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

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

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

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

l.v = c
e.w = f
e.v = f
e.p = b
e.q = h
d.t = n
d.x = c
d.y = c
d.s = l
d.o = h
f.r = m
h.z = m
h.s = c
c.s = h
n.v = c
b.t = l
b.s = l
b.x = c
b.y = c
b.o = h
k.w = f
k.v = f
k.p = d
k.q = h
m.t = l
m.x = c
m.y = c
m.s = n
m.o = h
assert d.y.s.z.y.s.s.s.z.x.txt == "c"