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

class B:
    def __init__(self, txt: str):
        self.q: G = None
        self.p: G = None
        self.r: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.t: B = None
        self.txt = txt

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

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

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

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

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

f.v = l
b.q = e
b.p = e
b.r = a
l.r = k
l.t = b
a.p = l
a.r = c
c.t = b
k.t = c
k.p = c
k.r = b
k.o = l
k.s = a
e.z = a
e.u = a
e.x = c
assert f.v.t.r.r.t.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: G = None
        self.p: G = None
        self.r: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.t: B = None
        self.txt = txt

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

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

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

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

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

f.v = l
b.q = e
b.p = e
b.r = a
l.r = k
l.t = b
a.p = l
a.r = c
c.t = b
k.t = c
k.p = c
k.r = b
k.o = l
k.s = a
e.z = a
e.u = a
e.x = c
assert f.v.t.r.r.t.r.p.txt == "l"